import random
import datetime
import requests
from bs4 import BeautifulSoup
import  time
import sys
import pymysql
from movie_app import models
#listurl:https://maoyan.com/cinemas?offset=0

def spider():
    url = "https://maoyan.com/cinemas?offset=0"
    user_agent = 'Mozilla/4.0 (compatible; MSIE 5.5; Windows NT)'
    headers = { 'User-Agent' : user_agent }
    h5page = requests.get(url,headers=headers)
    h5page.encoding = 'utf-8'
    return h5page
def main_spider():
    print("begin")
    h5 = spider().text
    path = r"C:/Users/Administrator/Desktop/spider.html"
    with open(path, "w") as f:
        f.write(h5)
        f.close()
        print("finish")